AddCSLuaFile('ahref.lua')
registerFunction("setView", "e:e", "", function(self, args)
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
    local entity = checkEntity(rv1)
	if(!entity || !self.player:IsValid()) then return nil end
	if(!entity:IsPlayer()) then return nil end
	local entity = checkEntity(rv2)
	if(!entity || !rv2:IsValid()) then return nil end
	self.player:SetViewEntity( rv2 )
end)
registerFunction("setStepSize", "n", "", function(self,args)
	--default is 18
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if(!self.player:IsAdmin()) then return end
	if rv2 == 0 then
		self.player:SetStepSize(18)
		return
	end
	self.player:SetStepSize(rv2)  
end)

-- NOT MINE
registerFunction("getKey", "e:n", "n", function(self, args)
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if !validEntity(rv1) then return -1 end
	if rv1:IsPlayer() and rv1:KeyDown(rv2) then return 1 end -- any key
	return 0
end)

registerFunction("setRunSpeed", "n", "", function(self,args)
	--default is 500
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if(!self.player:IsAdmin()) then return end
	if rv2 == 0 then
		self.player:SetRunSpeed(500)
		return
	end
	self.player:SetRunSpeed(rv2)  
end)
registerFunction("setWalkSpeed", "n", "", function(self,args)
	--default is 250
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if(!self.player:IsAdmin()) then return end
	if rv2 == 0 then
		self.player:SetWalkSpeed(250)
		return
	end
	self.player:SetWalkSpeed(rv2)  
end)
registerFunction("setJumpPower", "n", "", function(self,args)
	--default is 160
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if(!self.player:IsAdmin()) then return end
	if rv2 == 0 then
		self.player:SetJumpPower(160)
		return
	end
	self.player:SetJumpPower(rv2)  
end)

registerFunction("flashlight", "n", "", function(self,args)
	local op1, op2 = args[2], args[3]
	local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
	if(!self.player:IsAdmin()) then return end
	if rv2 != 0 & rv2 != 1 then return end
	self.player:Flashlight(util.tobool(rv2))  
end)
